package com.glela.packet.service.impl;

import com.glela.packet.mapper.RedPacketOmtBizMapper;
import com.glela.packet.mapper.RedPacketOmtMapper;
import com.glela.packet.model.RedPacketOmt;
import com.glela.packet.service.RedPacketOmtService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

@Service("redPacketOmtService")
public class RedPacketOmtServiceImpl implements RedPacketOmtService {

  @Autowired
  private RedPacketOmtMapper redPacketOmtMapper;
  @Autowired
  private RedPacketOmtBizMapper redPacketOmtBizMapper;

  @Override
  public RedPacketOmt getRedPacketOmtById(int id) {
    return redPacketOmtMapper.selectByPrimaryKey(id);
  }

  @Override
  public List<RedPacketOmt> listByIds(List<Integer> ids) {
    if (CollectionUtils.isEmpty(ids)){
      return  null;
    }
    return redPacketOmtBizMapper.listByIds(ids);
  }

  @Override
  public boolean updateRedPacketOmtRemainCount(RedPacketOmt redPacketOmt) {
    return redPacketOmtBizMapper.updateRemainCount(redPacketOmt) > 0;
  }
}
